
    import { 
        getOperLogPageList,
        getOperLogDetail,
    } from '@/api/baseFrame/base/operLog.js';
    import Treeselect from '@riophae/vue-treeselect'
    import '@riophae/vue-treeselect/dist/vue-treeselect.css'

    export default {
        name: "operlog",
        components: { Treeselect },
        data() {
            return {
                labelWidth: "100px",
                formLabelWidth:"100px",
                // 选中operId数组
                ids: [],
                // 非单个禁用
                single: true,
                // 非多个禁用
                multiple: true,
                // 遮罩层
                loading: false,
                // 显示搜索条件
                showSearch: true,
                // 查询参数
                queryParams: {
                    pageNum: 1,
                    pageSize: 10,
                    sort: undefined,
                    sortType: undefined,
                },
                defaultTreeProps: {
                    children: 'children',
                    label: 'label',
                },
                noOptionsText: '暂无数据',
                noChildrenText: '暂无子项',
                noResultsText: '未找到匹配项',
                loadingText: '数据加载中...',
                // 弹出层标题
                title: "",
                // 操作类型 1、add 2、edit
                opertype: 0,
                // 是否显示弹出层
                open: false,
                // 表单参数
                form: {},
                columns: [
                    { index: 0, key: 'operId', label: `操作id`, checked:  true  },
                    { index: 1, key: 'title', label: `操作模块`, checked:  true  },
                    { index: 2, key: 'businessType', label: `业务类型`, checked:  true  },
                    { index: 3, key: 'method', label: `请求方法`, checked:  true  },
                    { index: 4, key: 'requestMethod', label: `请求方式`, checked:  true  },
                    { index: 5, key: 'operatorType', label: `操作类别`, checked:  true  },
                    { index: 6, key: 'operName', label: `操作人员`, checked:  true  },
                    { index: 7, key: 'operUrl', label: `请求url`, checked:  true  },
                    { index: 8, key: 'operIp', label: `操作地址`, checked:  true  },
                    { index: 9, key: 'operLocation', label: `操作地点`, checked:  false  },
                    { index: 10, key: 'status', label: `操作状态`, checked:  false  },
                    { index: 11, key: 'errorMsg', label: `错误消息`, checked:  false  },
                    { index: 12, key: 'operTime', label: `操作时间`, checked:  false  },
                    { index: 13, key: 'elapsed', label: `操作用时`, checked:  false  },
                ],
                dataList: [],
                total: 0,
                rules: {
                },
            };
        },
        watch: {
        },
        created() {
            // 列表数据查询
            this.getList();
            var dictParams = [
            ];
        },
        methods: {
            normalizer(node) {
                return {
                    id: node.id,
                    label: node.label,
                    children: node.children,
                    isDisabled: node.isDisabled==true || node.isDisabled=='True'
                };
            },
            // 查询数据
            getList() {
                this.loading = true;
                getOperLogPageList(this.queryParams).then(res => {
                    if (res.code == 200) {
                        this.dataList = res.data.result;
                        this.total = res.data.totalNum;
                        this.loading = false;
                    }
                })
            },

            // 取消按钮
            cancel() {
                this.open = false;
                this.reset();
            },
            // 重置数据表单
            reset() {
                this.form = {
                };
                this.resetForm("form");
            },
            // 重置查询操作
            resetQuery() {
                this.timeRange = [];
                this.resetForm("queryForm");
                this.queryParams.treeNodeId=undefined;
                this.handleQuery();
            },
            // 多选框选中数据
            handleSelectionChange(selection) {
                    this.ids = selection.map((item) => item.operId);
                    this.single = selection.length != 1
                    this.multiple = !selection.length;
            },
            // 自定义排序
            sortChange(column) {
                    if (column.prop == null || column.order == null) {
                        this.queryParams.sort = undefined;
                        this.queryParams.sortType = undefined;
                    } else {
                        this.queryParams.sort = column.prop;
                        this.queryParams.sortType = column.order;
                    }

                    this.handleQuery();
            },
            /** 搜索按钮操作 */
            handleQuery() {
                this.queryParams.pageNum = 1;
                this.getList();
            },



                //图片上传成功方法
                handleUploadSuccess(column, filelist) {
                        this.form[column] = filelist;
                },


    },
};